<template>
  <div class="c-bg-sgray">
    <div class="c-pt6 c-bg-white">
      <new-search-bar :selectList="selectList" :searchText="searchText" @search="startSearch" @cancel="startSearch"></new-search-bar>
    </div>
    <div class="c-bg-white c-flex-row c-ph24 c-justify-sb c-pb12" v-show="((showLevel - 1)==1 || (showLevel - 1)==0) && type < 3">
      <my-small-tabbar :tabHeight="'48'" class="c-flex-grow1 c-w0" :tabList="tabList" :tabIndex="level" :isScroll="true" @changeTab="changeLevel"></my-small-tabbar>
    </div>
    <div class="c-w100 c-contextX-scroll c-ws-n c-bg-white c-pb12" v-show="type==3">
      <div class="c-ph24 c-bd-t2">
        <my-small-tabbar class="c-flex-grow1" :tabHeight="'48'" :tabList="tabList" :tabIndex="level" @changeTab="changeLevel" :isScroll="true"></my-small-tabbar>
      </div>
    </div>

    <!-- <div class="c-bg-white" v-if="(showLevel - 1) == 0 && type < 3">
      <div class="c-fs28 c-fc-xblack c-pv28 c-ph24 c-w100 c-flex-row c-justify-sb c-aligni-center c-lh">
        <span class="" @click="changeLevel(1)">我的{{isBCompany == 1 ? '蜜友' : '同学'}}({{l1Num}})</span>
      </div>
    </div> -->

    <div class="c-flex-row c-justify-sb c-aligni-center c-ph24 c-fs22 c-bg-sgray c-pv20">
      <div @click="changeCondition(1)" :class="conditionType == 1 ? 'theme-fc' : ''">
        <div class="c-flex-row c-aligni-center">
          <span class="c-fs22">注册</span><span class="iconfont c-fs20 c-ml10" v-if="conditionType != 1">&#xe985;</span>
          <div class="c-aligni-center c-ml10" :class="conditionType == 1 ? 'c-flex-row' : 'c-flex-column'" v-if="conditionType == 1">
            <span class="iconfont c-fs16" v-if="sortType != 0">&#xe712;</span>
            <span class="iconfont c-fs16" v-if="sortType != 1">&#xe714;</span>
          </div>
        </div>
      </div>
      <div class="" @click="changeCondition(2)" :class="conditionType == 2 ? 'theme-fc' : ''">
        <div class="c-flex-row c-aligni-center">
          <span class="c-fs22">活跃</span><span class="iconfont c-fs20 c-ml10" v-if="conditionType != 2">&#xe985;</span>
          <div class=" c-aligni-center c-ml10" :class="conditionType == 2 ? 'c-flex-row' : 'c-flex-column'" v-if="conditionType == 2">
            <span class="iconfont c-fs16" v-if="sortType != 2">&#xe712;</span>
            <span class="iconfont c-fs16" v-if="sortType != 3">&#xe714;</span>
          </div>
        </div>
      </div>
      <div class="" @click="changeCondition(3)" :class="conditionType == 3 ? 'theme-fc' : ''">
        <div class="c-flex-row c-aligni-center">
          <span class="c-fs22">{{level == 99 ? '到期时间' : '消费总额'}}</span><span class="iconfont c-fs20 c-ml10" v-if="conditionType != 3">&#xe985;</span>
          <div class="c-aligni-center c-ml10" :class="conditionType == 3 ? 'c-flex-row' : 'c-flex-column'" v-if="conditionType == 3">
            <span class="iconfont c-fs16" v-if="sortType != 4">&#xe712;</span>
            <span class="iconfont c-fs16" v-if="sortType != 5">&#xe714;</span>
          </div>
        </div>
      </div>
    </div>

    <div class="c-bg-sgray">
      <div class=" c-ph24 c-pb60" v-if="dataInfo != null && dataInfo != '' && dataInfo.length > 0">
        <div class="c-mb20 c-bg-white c-br12 c-pv24 c-ph24 c-p" v-for="(item) in dataInfo" @click="goClassMatesDetail(item.userId)" :key="item.userId">
          <div class="c-flex-row c-justify-sb c-pb20 c-bd-b1-f6">
            <img :src="$addXossFilter(item.avatar, require('../../../assets/defult_head.png'))" @error="item.avatar = require('../../../assets/defult_head.png')" class="c-ww80 c-hh80 c-brp50" />
            <div class="c-flex-column c-pl20 c-flex-grow1 c-w0">
              <div class="c-flex-row c-aligni-center">
                <span class="c-fs24 c-fc-xblack c-text-ellipsis1">{{item.nickname ? item.nickname : '未知'}}</span>
              </div>
              <div class="c-flex-row c-aligni-center c-mt20">
                <div class="c-fc-gray c-fs20 c-mr20 c-minw140">
                  <span v-if="item.hasSubType" class="c-bg-f2">{{item.subName}}</span>
                  <identity-com class="c-mr20" v-else :vipType="item.vipType"></identity-com>
                </div>
                <div class="c-fs20 c-fc-gray">ID：{{item.userId ? item.userId : '--'}}</div>
              </div>
              <div class="c-flex-row c-aligni-center c-mt20">
                <div class="c-fs20 c-fc-gray c-mr20 c-minw140">姓名：{{item.realName ? item.realName : '--'}}</div>
                <div class="c-fs20 c-fc-gray" v-if="allInfo.enableShowClassMatePhone">电话：{{item.mobile ? item.mobile : '--'}}</div>
              </div>
              <div class="c-flex-row c-justify-sb c-aligni-center c-pr20 c-mt20" v-if="level == 2">
                <span class="c-fs20 c-fc-gray">推荐人：{{item.refereeUserName ? item.refereeUserName : '--'}}</span>
              </div>
              <!-- <div class="c-flex-row c-justify-sb c-aligni-center c-pr20 c-mt20" v-if="!!item.consumedMoney">
                <span class="c-fs20 c-fc-gray">消费总额：{{'￥' | iosPriceFilter}}{{item.consumedMoney}}</span>
              </div> -->
              <div class="c-flex-row c-justify-sb c-aligni-center c-pr20 c-mt20" v-if="level == 99">
                <span class="c-fs20 c-fc-gray">预绑定时间：{{item.reservedAt}}</span>
              </div>
              <div class="c-flex-row c-justify-sb c-aligni-center c-pr20 c-mt20" v-if="level == 99">
                <span class="c-fs20 c-fc-gray">到期时间：{{item.protectPeriod}}</span>
              </div>
              <!-- <div class="c-flex-row c-justify-sb c-aligni-center c-pr20 c-mt16">
                <span class="c-fs20 c-fc-gray">姓名：{{item.realName ? item.realName : '--'}}</span>
              </div>
              <div class="c-flex-row c-justify-sb c-aligni-center c-pr20 c-mt16" v-if="allInfo.enableShowClassMatePhone">
                <span class="c-fs20 c-fc-gray">TEL：{{item.mobile ? item.mobile : '--'}}</span>
              </div> -->
            </div>
          </div>
          <div v-if="level == 99" class="c-flex-row c-justify-sb c-aligni-center c-pr20 c-mt20">
            <div class="c-w0 c-flex-grow1">
              <span class="c-fs20 c-fc-xblack" v-if="!!item.consumedMoney">消费总额：<span class="c-fs22 c-fc-xmlred c-fw600">{{'￥' | iosPriceFilter}}{{item.consumedMoney}}</span></span>
            </div>
            <div v-if="!isFaShou" @click.stop="goSpread" class="c-ww110 c-hh48 c-br24 c-flex-row c-flex-center theme-bg c-fs22 c-fc-white">去推广</div>
          </div>
          <div v-else class="c-flex-row c-justify-sb c-aligni-center c-pr20 c-mt20">
            <div class="c-w0 c-flex-grow1">
              <span class="c-fs20 c-fc-xblack" v-if="!!item.consumedMoney">消费总额：<span class="c-fs22 c-fc-xmlred c-fw600">{{'￥' | iosPriceFilter}}{{item.consumedMoney}}</span></span>
            </div>
            <div v-if="item.bindAt && item.expirationDate && checkTime(item.bindAt, item.expirationDate) == -1 && level ==1 && !isFaShou" @click.stop="goSpread" class="c-ww110 c-hh48 c-br24 c-flex-row c-flex-center theme-bg c-fs22 c-fc-white">去推广</div>
            <!-- <span class="c-fs20 c-fc-xblack"
              v-if="item.bindAt && item.expirationDate">
              <span class="theme-fc" @click.stop="goSpread" v-if="checkTime(item.bindAt, item.expirationDate) == -1 && level ==1 && !isFaShou">去推广<span
                class="icon iconfont theme-fc c-fs20">&#xe60e;</span></span></span> -->
          </div>
          <div v-if="level == 99 && checkTime(item.reservedAt, item.protectPeriod) == -1" class="c-fs18 c-fc-xmlred c-ph10 c-hh28 c-flex-row c-flex-center c-bg-xmlred-10 c-br-tr12 c-br-bl12 c-pa c-p-t0 c-p-r0">已过期</div>
          <div v-if="level != 99 && item.bindAt && item.expirationDate" class="c-fs18 c-fc-xmlred c-ph10 c-hh28 c-flex-row c-flex-center c-bg-xmlred-10 c-br-tr12 c-br-bl12 c-pa c-p-t0 c-p-r0">{{checkTime(item.bindAt, item.expirationDate) == 1 ? (item.expirationDate.split(" ")[0] == '9999-12-31' ? '长期有效' : (item.expirationDate.split(" ")[0]+'到期')) : (checkTime(item.bindAt, item.expirationDate) == -1 && level ==1 ? '已过期' : '')}}</div>
        </div>
      </div>
      <loading-status-tem :noData="noneShow" :dataStatus="loadingStatus" :noDataText="'暂无相关人员'" :showLoading="isLoading"></loading-status-tem>
    </div>

    <!-- <div class="c-ww140 c-hh52 theme-fc c-fs22 c-ph24 c-pv10 c-flex-row c-flex-center c-pf c-p-r0 income c-pz100 c-bg-white" @click="goIncomeDetail">收入明细</div> -->
    <!-- 统计规则介绍 -->
    <open-modal :openModal="openModal" @closeModal="closeModal">
      <div class="c-bg-white c-br-tl20 c-br-tr20 c-pt40 c-pr40 c-pb30 c-pl40 c-maxh760 ">
        <div class="c-textAlign-c c-fs28">我的同学统计规则</div>
        <div class="c-fs20 c-hh500 c-contexty-auto" v-if="profitModel > 2">
          <div class="c-w100">
            <img class="c-block c-w100" src="https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/profitModel_img.png" alt="">
          </div>
          <p class="c-mb20">直接同学：A直接推荐的第一级用户；上图A的直接同学有：B1、B2；</p>
          <p>间接同学： A直推的学员，再去直推的用户，上图A的间接同学有：C1、C2、C3、C4。D1、D2不是B1直推的，所以不统计在内；</p>
        </div>
        <div class="c-fs20 c-hh500 c-contexty-auto" v-else>
          <div class="c-w100">
            <img class="c-block c-w100" src="https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/profitModel_img.png" alt="">
          </div>
          <p class="c-mb20">直接同学：A直接推荐的第一级用户；上图A的直接同学有：B1、B2；</p>
          <p>间接同学：A直推的学员，再去直推的用户，上图A的间接同学有：C1、C2、C3、C4。D1、D2不是B1直推的，所以不统计在内；</p>
        </div>
      </div>
    </open-modal>
    <div @click="goIncomeDetail" class="c-pf c-p-b0 c-bg-white c-maxw640 c-w100 c-hh100 c-box-shadow2 c-ph24 c-flex-row c-flex-center">
      <div class="c-fs28 c-fc-white c-w100 c-hh64 c-flex-row c-flex-center theme-bg c-br32">收入明细</div>
    </div>
  </div>
</template>

<script>
import newSearchBar from "@/components/templates/common/newSearchBar.vue"
import loadingStatusTem from "@/components/templates/common/loadingStatusTem.vue";
import { utilJs } from "@/utils/common.js"
import MySmallTabbar from "@/components/templates/common/MySmallTabbar.vue";
import openModal from "@/components/templates/common/openModal.vue";
import identityCom from "@/components/templates/common/identityCom.vue";
let pageIndex = 1; //当前页面
export default {
  name: 'ClassmatesIndex',
  components: {
    loadingStatusTem,
    MySmallTabbar,
    openModal,
    newSearchBar,
    identityCom
  },
  props: [],
  beforeCreate() {

  },
  data() {
    return {
      isFaShou: localStorage.getItem("isFaShou") == 1,
      theme: localStorage.getItem("colorName") ? localStorage.getItem("colorName") : 'mb5_default',
      themeName: localStorage.getItem('themeName') ? localStorage.getItem('themeName') : 'mb5',
      type: 0,
      level: 1, // 当前级别
      dataInfo: [],
      l1Num: 0,
      l2Num: 0,
      l3Num: 0,
      indirectNum: 0, // 服务商间接关系
      agentNum: 0,
      staffNum: 0,
      noneShow: false,
      isBCompany: localStorage.getItem("companyId") == 'ldwk' ? 1 : 0,
      // isShowPartnerEnter: false, // 显示服务商关系入口
      showLevel: -1, // 显示级数
      nickname: "", // 搜索文本
      realName: "", // 搜索姓名
      mobile: "", // 搜索文本
      userId: "", //搜索用户id
      searchText: "", //搜索文本
      loadingStatus: "HAS_MORE_DATA", //显示加载更多LOAD_MORE 加载中 LOADING 没有更多 NO_MORE_DATA
      isLoading: false,
      customName: JSON.parse(localStorage.getItem("customName")),
      companyAuth: JSON.parse(localStorage.getItem("companyAuth")),
      to: 0,
      limit: 10,
      currentPage: 1,
      tabList: [],
      selectList: [["昵称", "姓名", "ID", "电话"]],
      openModal: false,
      profitModel: localStorage.getItem("profitModel"), // 判断新、旧分成模式
      subTypeArr: [], //服务商拓展名称
      statisticalConditions: ['注册', '活跃', '消费总额'],
      sortType: 0, //0按照注册时间倒序 1注册时间升序 2活跃倒序 3活跃升序 4消费总额倒序 5消费总额升序
      conditionType: 1, // 注册 活跃 消费总额
      vipType: localStorage.getItem(`vipType${localStorage.getItem("userId")}`),
      allInfo: {},
      searchType: 1 //搜索预绑定用户 1昵称，2真实姓名，3用户id，4手机号
    }
  },
  created() {
    utilJs.appShare(this);
  },
  mounted() {

  },
  computed: {

  },
  watch: {

  },
  methods: {
    closeModal: function () {
      // 关闭统计规则
      this.openModal = false;
    },
    // handleClickRules: function () {
    //   // 点击统计规则
    //   this.openModal = true;
    // },
    checkTime: function (bindAt, expirationDate) {
      console.log(".....", bindAt, expirationDate);
      let ba = bindAt && utilJs.getTimeByDate(bindAt);
      let e = expirationDate && utilJs.getTimeByDate(expirationDate);
      let nt = (new Date()).getTime();
      if (bindAt && expirationDate) {
        if (nt <= e && ba < e) {
          return 1; //未过期
        } else {
          return -1; //已过期
        }
      } else {
        return 0; //永久有效
      }
    },
    goSpread: function () {
      this.$routerGo(this, "push", { path: "/homePage/spread/spreadIndex" });
    },
    // changeType: function (type) {
    //   this.type = type;
    //   this.getMyClassmates();
    // },
    goClassMatesDetail: function (memberId) {
      this.$routerGo(this, "push", { path: "/member/classmates/classmatesDetail", query: { 'memberId': memberId, 'type': this.type, 'level': this.level } });
    },
    changeLevel(num) {
      if ((this.level == 99 || num == 99) && this.level != num && this.conditionType == 3) {
        this.conditionType = 1;
        this.sortType = 0;
      }
      this.level = num;
      pageIndex = 1;
      this.dataInfo = [];
      this.getMyClassmates();
    },
    getReservedRefereeList() {
      // 获取预绑定用户列表
      if (!this.isLoading) {
        this.isLoading = true;
        var $this = this;
        this.$loading.show();
        //from = 1 我的同学，2：团队管理
        utilJs.getMethod(global.apiurl + 'members/getReservedRefereeList?page=' + pageIndex + '&searchType=' + this.searchType + '&searchKeyword=' + this.searchText + '&sort=' + this.sortType, function (res) {
          $this.$loading.hide();
          // $this.allInfo = res;
          if (pageIndex == 1) {
            $this.dataInfo = res.data;
          } else {
            $this.dataInfo = [...$this.dataInfo, ...res.data];
          }
          if ($this.dataInfo) {
            for (let i = 0; i < $this.dataInfo.length; i++) {
              if ($this.dataInfo[i].hasSubType == 1 && $this.subTypeArr && $this.subTypeArr.length > 0) {
                $this.dataInfo[i].hasSubType = true;
                $this.dataInfo[i].subType = $this.dataInfo[i].subType ? $this.dataInfo[i].subType : 0;
                let tItem = $this.subTypeArr.filter((item) => {
                  return item.subType == $this.dataInfo[i].subType;
                })
                if (tItem && tItem.length > 0) {
                  $this.dataInfo[i].subName = tItem[0].name;
                }
              }
            }
          }
          if ($this.dataInfo == null || $this.dataInfo.length == 0) {
            $this.noneShow = true;
          } else {
            $this.noneShow = false;
          }
          // $this.to = res.data.to
          // $this.limit = res.data.per_page
          // $this.currentPage = pageIndex
          if (res.data && res.data.length < 10) {
            $this.loadingStatus = pageIndex == 1 && res.data.length == 0 ? 'NO_DATA' : 'NO_MORE';
          } else {
            $this.loadingStatus = "HAS_MORE_DATA";
            pageIndex++;
          }
          $this.isLoading = false;
        }, function () {
          $this.$loading.hide();
          $this.isLoading = false;
        })
      }
    },
    getMyClassmates() {
      if (this.level == 99) {
        this.getReservedRefereeList()
        return;
      }
      // 获取我的同学信息
      if (!this.isLoading) {
        this.isLoading = true;
        var $this = this;
        this.$loading.show();
        //from = 1 我的同学，2：团队管理
        utilJs.getMethod(global.apiurl + 'members/followers?from=1&page=' + pageIndex + '&level=' + this.level + '&nickname=' + this.nickname + '&mobile=' + this.mobile + '&userId=' + this.userId + '&realName=' + this.realName + '&sort=' + this.sortType, function (res) {
          $this.companyAuth = JSON.parse(localStorage.getItem("companyAuth"));
          $this.customName = JSON.parse(localStorage.getItem("customName"));
          $this.$loading.hide();
          $this.allInfo = res;
          if (pageIndex == 1) {
            $this.dataInfo = res.data.data;
            $this.subTypeArr = res.subTypeName;
          } else {
            $this.dataInfo = [...$this.dataInfo, ...res.data.data];
          }
          if ($this.dataInfo) {
            for (let i = 0; i < $this.dataInfo.length; i++) {
              if ($this.dataInfo[i].hasSubType == 1 && $this.subTypeArr && $this.subTypeArr.length > 0) {
                $this.dataInfo[i].hasSubType = true;
                $this.dataInfo[i].subType = $this.dataInfo[i].subType ? $this.dataInfo[i].subType : 0;
                let tItem = $this.subTypeArr.filter((item) => {
                  return item.subType == $this.dataInfo[i].subType;
                })
                if (tItem && tItem.length > 0) {
                  $this.dataInfo[i].subName = tItem[0].name;
                }
              }
            }
          }
          $this.l1Num = res.l1Num ? res.l1Num : 0
          $this.l2Num = res.l2Num ? res.l2Num : 0
          $this.l3Num = res.l3Num ? res.l3Num : 0
          $this.indirectNum = res.indirectNum ? res.indirectNum : 0
          $this.agentNum = res.agentNum ? res.agentNum : 0
          $this.staffNum = res.staffNum ? res.staffNum : 0
          $this.showLevel = res.showLevel
          if (($this.showLevel - 1) == 0 && $this.type < 3) {
            $this.tabList = [
              {
                title: '我的' + ($this.isBCompany == 1 ? '蜜友' : '同学') + '(' + $this.l1Num + ')',
                index: 1,
              }
            ]
          } else if (($this.showLevel - 1) == 2 && $this.type < 3 && $this.companyAuth.enableClassmate > 1) {
            $this.tabList = [
              {
                title: localStorage.getItem("companyId") == 'ldwk' ? '一级密友(' + $this.l1Num + ')' : '一级同学' + '(' + $this.l1Num + ')',
                index: 1,
              }, {
                title: localStorage.getItem("companyId") == 'ldwk' ? '二级密友(' + $this.l2Num + ')' : '二级同学(' + $this.l2Num + ')',
                index: 2,
              },
              {
                title: localStorage.getItem("companyId") == 'ldwk' ? '三级密友(' + $this.l3Num + ')' : '三级同学(' + $this.l3Num + ')',
                index: 3,
              }
            ]
          } else if (($this.showLevel - 1) == 1 && $this.type < 3 && $this.companyAuth.enableClassmate > 1) {
            $this.tabList = [
              {
                title: localStorage.getItem("companyId") == 'ldwk' ? '直接密友(' + $this.l1Num + ')' : '直接同学' + '(' + $this.l1Num + ')',
                index: 1,
              }, {
                title: localStorage.getItem("companyId") == 'ldwk' ? '间接密友(' + $this.l2Num + ')' : '间接同学(' + $this.l2Num + ')',
                index: 2,
              }
            ]
          } else if ($this.type == 3 && $this.companyAuth.enableClassmate > 1) {
            $this.tabList = [
              {
                title: '直接关系' + '(' + $this.l1Num + ')',
                index: 1,
              }, {
                title: '间接关系' + '(' + $this.indirectNum + ')',
                index: 6,
              }, {
                title: $this.customName.serviceProviderName + '(' + $this.agentNum + ')',
                index: 4,
              }, {
                title: '员工' + '(' + $this.staffNum + ')',
                index: 5
              }
            ]
          } else {
            $this.tabList = [
              {
                title: localStorage.getItem("companyId") == 'ldwk' ? '一级密友(' + $this.l1Num + ')' : '一级同学' + '(' + $this.l1Num + ')',
                index: 1,
              }
            ]
          }
          if (res.bindMode == 2) {
            $this.tabList.push({ //与绑定用户
              title: '预绑定用户',
              index: 99
            })
          }
          // if (res.vipType == 3 || res.vipType == 5 || res.vipType == 6 || res.vipType == 7 || res.vipType == 8) {
          //   $this.isShowPartnerEnter = true
          //   // $this.type = res.showLevel - 1
          // } else {
          //   $this.isShowPartnerEnter = false
          //   $this.type = res.showLevel - 1
          // }
          if ($this.dataInfo == null || $this.dataInfo.length == 0) {
            $this.noneShow = true;
          } else {
            $this.noneShow = false;
          }
          $this.to = res.data.to
          $this.limit = res.data.per_page
          $this.currentPage = pageIndex
          if (res.data && res.data.data.length < 10) {
            $this.loadingStatus = pageIndex == 1 && res.data.data.length == 0 ? 'NO_DATA' : 'NO_MORE';
          } else {
            $this.loadingStatus = "HAS_MORE_DATA";
            pageIndex++;
          }
          $this.isLoading = false;
        }, function () {
          $this.$loading.hide();
          $this.isLoading = false;
        })
      }
    },
    changeCondition(type) {
      this.conditionType = type;
      this.sortType = type == 1 ? (this.sortType == 0 ? 1 : 0) : type == 2 ? (this.sortType == 2 ? 3 : 2) : (this.sortType == 4 ? 5 : 4);
      pageIndex = 1;
      this.dataInfo = [];
      this.getMyClassmates();
    },
    startSearch(data) {
      pageIndex = 1;
      let si = data.selectItem;
      this.userId = "";
      this.nickname = "";
      this.realName = "";
      this.mobile = "";
      if (si == '昵称') {
        this.nickname = data.searchValue;
        this.searchType = 1;
      } else if (si == '姓名') {
        this.realName = data.searchValue;
        this.searchType = 2;
      } else if (si == 'ID') {
        this.userId = data.searchValue;
        this.searchType = 3;
      } else if (si == '电话') {
        this.mobile = data.searchValue;
        this.searchType = 4;
      }
      this.searchText = data.searchValue;
      this.getMyClassmates();
    },
    //分享
    wechatShare: function () {
      let shareUrl =
        window.location.href.split("#")[0] +
        "#" +
        this.$route.path +
        "?refereeId=" +
        localStorage.getItem("userId");
      let shareTitle = this.isBCompany == 1 ? '我的蜜友' : '我的同学';
      utilJs.wechatConfig(shareUrl, shareTitle, "", "", function () { });
    },
    //手机端分享
    appShare: function () {
      let shareUrl =
        window.location.href.split("#")[0] +
        "#" +
        this.$route.path +
        "?refereeId=" +
        localStorage.getItem("userId");
      let shareTitle = this.isBCompany == 1 ? '我的蜜友' : '我的同学';
      utilJs.appShareTrue(shareTitle, "", shareUrl, "");
    },

    // linkToPartner() {
    //   // 点击服务商
    //   this.type = 3;
    //   this.level = 1;
    //   pageIndex = 1;
    //   this.nickname = '';
    //   this.realName = "";
    //   this.mobile = ''
    //   this.userId = "";
    //   this.searchText = "";
    //   this.tabList = [];
    //   this.getMyClassmates();
    // },
    // linkToBack() {
    //   // 点击返回
    //   this.level = 1;
    //   pageIndex = 1;
    //   this.nickname = '';
    //   this.realName = "";
    //   this.mobile = ''
    //   this.userId = "";
    //   this.searchText = "";
    //   this.type = this.showLevel - 1
    //   this.tabList = [];
    //   this.getMyClassmates();
    // },
    goIncomeDetail() {
      this.$routerGo(this, "push", {
        path: "/member/scholarship/scholarshipIndex",
      })
    },
    windowScrollFunction: function () {
      this.userId = "";
      this.nickname = "";
      this.realName = "";
      this.mobile = "";
      this.searchText = "";
      let that = this;
      utilJs.handleLoading(function () {
        if (that.loadingStatus == 'HAS_MORE_DATA' && that.dataInfo.length > 0) {
          that.getMyClassmates();
        }
      });
    }
  },
  beforeRouteEnter(to, from, next) {
    if (from.path.includes('/member/classmates/classmatesDetail')) {
      next(vm => {
        vm.$store.commit('updateLoadingStatus', {
          isLoading: false
        });
      });
    } else {
      next(vm => {
        pageIndex = 1;
        vm.loadingStatus = "HAS_MORE_DATA";
        vm.level = 1;
        vm.sort = 0;
        vm.dataInfo = [];
        vm.allInfo = {};
        vm.getMyClassmates();
        vm.isLoading = false;
      });
    }
  },
  activated() {
    let customName = this.$route.query.name && this.$route.query.name != undefined
                     ? this.$route.query.name
                     : (this.isBCompany == 1 ? "我的蜜友" : '推广用户');
    setDocumentTitle(customName);// eslint-disable-line
    // pageIndex = 1
    // this.getMyClassmates();
    // this.isLoading = false;
    // this.level = 1;
    // this.sort = 0;
    // this.vipType = "";
    this.userId = "";
    this.nickname = "";
    this.realName = "";
    this.mobile = "";
    this.searchType = 0;
    this.sortType = 0;
    this.conditionType = 1;
    window.addEventListener('scroll', this.windowScrollFunction);
    this.wechatShare();
  },
  deactivated() {
    // this.loadingStatus = 'NO_MORE_DATA';
    window.removeEventListener('scroll', this.windowScrollFunction);
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.enter-back {
  height: 1.2rem;
  background: linear-gradient(to right, #ff8920, #ffc26b);
  width: 3.5rem;
  height: 1.2rem;
  text-align: center;
  border-radius: 3.75rem 0px 0px 3.75rem;
}
.enter-div {
  position: fixed;
  right: 0;
  bottom: 63px;
  width: 3.5rem;
  height: 1.2rem;
  text-align: center;
  background: linear-gradient(to right, #ff8920, #ffc26b);
  border-radius: 3.75rem 0px 0px 3.75rem;
}
.income {
  top: 17.6rem;
  border-radius: 100px 0px 0px 100px;
  box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.1);
}
.bg-lpink {
  background-color: #fff1e5;
}
.fc-red {
  color: #ff300c;
}
.bg-gradient {
  background: linear-gradient(90deg, #ff300c, rgba(255, 48, 12, 0.7));
}
</style>
